#include "calculateCenter6.h"

//this test is succeeding along with test5 but has better performance
//I didn't know how to fail it just based on the performance. So I used t
Result test6() {
	IplImage* img = cvLoadImage("C:\\Documents and Settings\\snirbo\\Desktop\\calculate_center\\pic3.bmp");	
	int* new_data = ConvertFromRgbToHsv(img);
	uchar *data = (uchar *)img->imageData;
	int channels  = img->nChannels;
	int step = img->widthStep;
	car test_car;
	test_car.licensePlate = 1;
	test_car.red = PIC3_RED;
	test_car.green = PIC3_GREEN;
	test_car.blue = PIC3_BLUE;
	test_car.h = PIC3_H;
	test_car.s = PIC3_S;
	test_car.v = PIC3_V;
	test_car.p = cvPoint(PIC3_START_X, PIC3_START_Y);
	CvPoint x = calculateCenter(img, new_data, test_car);
	if ( (x.x == PIC3_CENTER_X) && (x.y == PIC3_CENTER_Y)) {
		return (printTestResult(6, SUCCESS));
	} else {
		return (printTestResult(6, FAIL));
	}
}

#ifdef __TEST6__
int main(int argc, char **argv) {
	if (!test1() || !test2() || !test3() || !test4() || !test5() || !test6()) {
		cout << "TOTAL TEST FAILED!\n";
		getchar();
		exit(1);
	}
	cout << "TOTAL TEST SUCCEEDED\n";
	getchar();
	return 0;
}
#endif